<!--
 * @Author: zehao.chen
 * @Date: 2022-07-10 11:03:30
 * @LastEditors: zehao.chen
 * @LastEditTime: 2022-07-10 14:16:31
 * @FilePath: /meeting-admin/src/components/WarnPanelDialog/index.vue
 * @Description:
 *
-->
<template>
  <div>
    <!--删除提示-->
    <el-dialog
      title=""
      :visible.sync="warnningDialog"
      width="20%"
      :close-on-click-modal="false"
      :before-close="handleWarnClose"
      center
    >
      <div class="warn-container-box">
        <div class="flex-row">
          <div class="el-icon-warning-outline big-icon" />
          <div class="warn-words">{{warnTitle}}</div>
        </div>
        <div class="small-tips">
          {{warnContent}}
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="cancelEmit">{{cancelText}}</el-button>
        <el-button type="primary" @click="confirmEmit">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: 'WarnPanelDialog',
  props: {
    statusProp: {
      type: Boolean,
      default: false
    },
    cancelText: {
      type: String,
      default: '取 消'
    },
    warnTitle: {
      type: String,
      default: '删除提醒'
    },
    warnContent: {
      type: String,
      default: '是否同步删除本地终端文件。'
    },
    isEmitCloseMethods: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      warnningDialog: false
    }
  },
  computed: {
    propStatus() {
      return this.$props.statusProp
    }
  },
  watch: {
    propStatus(val) {
      console.log('val ---', val)
      this.warnningDialog = val
    }
  },
  mounted() {
    console.log('初始化')
    console.log('this.$props.statusProp ---', this.$props.statusProp)
  },
  component: {},
  methods: {
    handleWarnClose() {
      if(this.isEmitCloseMethods) {
        this.$emit('closeHandler')
      } else {
        this.$emit('cancelHandler')
      }
    },
    cancelEmit() {
      this.$emit('cancelHandler')
    },
    confirmEmit() {
      this.$emit('confirmHandler')
    }
  }
}
</script>

<style scoped>
.icon-big{
  display: block;
  font-size: 36px;
  cursor: pointer;
}
.big-icon{
  font-size: 42px;
}
.flex-row{
  display: flex;
  align-items: center;
  font-size: 18px;
  justify-content: center;
}
.warn-container-box{
  text-align: center;
}
.warn-words{
  margin-left: 30px;
}
.small-tips{
  margin-top: 15px;
}
</style>
